﻿@using UsedBookTradeSystem.Models.Enum

@{
    ViewData["Title"] = "MyInfo";
    Layout = "~/Views/Shared/_BackLayout.cshtml";
    GenderEnum Gender = ViewBag.UserInfo.Gender;
    var selectedMale = Gender == GenderEnum.Male ? true : false;
    var selectedFemale = Gender == GenderEnum.Female ? true : false;
    var selectedUnknown = Gender == GenderEnum.Unknown ? true : false;
}

<div class="container-fluid flex-grow-1 container-p-y">
    <h4 class="font-weight-bold py-3 mb-0">个人信息</h4>

    <div class="card mb-4">
        <h6 class="card-header">修改个人信息</h6>
        <div class="card-body">
            <form action="/Admin/UpdateMyInfo" method="post">
                <div class="form-group row">
                    <input name="Id" value="@ViewBag.UserInfo.Id" hidden/>
                    <label class="col-form-label col-sm-2 text-sm-right">用户名</label>
                    <div class="col-sm-10">
                        <input hidden type="text" value="@User.Identity.Name" name="username"/>
                        <input type="text" class="form-control" value="@User.Identity.Name" readonly/>
                        <div class="clearfix"></div>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-form-label col-sm-2 text-sm-right">密码</label>
                    <div class="col-sm-10">
                        <input type="password" name="Password" class="form-control" placeholder="请输入密码">
                        <div class="clearfix"></div>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-form-label col-sm-2 text-sm-right">确认密码</label>
                    <div class="col-sm-10">
                        <input type="password" name="ConfirmPassword" class="form-control" placeholder="请确认密码">
                        <div class="clearfix"></div>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-form-label col-sm-2 text-sm-right">电话号码</label>
                    <div class="col-sm-10">
                        <input type="text" name="Tel" class="form-control" value="@ViewBag.UserInfo.Tel" placeholder="请确认密码">
                        <div class="clearfix"></div>
                    </div>
                </div>
                <fieldset class="form-group">
                    <div class="row">
                        <label class="col-form-label col-sm-2 text-sm-right pt-sm-0" style="margin-top:10px;">性别</label>
                        <div class="col-sm-10">
                            <select class="custom-select" name="Gender">  
                                <option value="0" selected="@selectedMale">男</option>  
                                <option value="1" selected="@selectedFemale">女</option>
                                <option value="2" selected="@selectedUnknown">未知</option>
                            </select>  
                        </div>
                    </div>
                </fieldset>
                <div class="form-group row">
                    <div class="col-sm-10 ml-sm-auto">
                        <button type="submit" class="btn btn-success">确定</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

